const Koa = require('koa');
const router = require('./router/router');   //后端路由设置文件-------------这是第二个文件，路由文件
const cors = require('koa2-cors'); //跨域处理
const bodyParser = require('koa-bodyparser');  //post请求参数处理
const static = require('koa-static');   //静态资源中间件
const path = require('path');   //路径管理中间件

const app = new Koa();


app.use(static(
    path.join(__dirname,'./dist/')
))

app.use(cors());
app.use(bodyParser())
app.use(router())


app.listen(5000, () => {
    console.log('[demo] route-use-middleware is starting at port 5000');
})
